<%@ taglib prefix="s" uri="/struts-tags"%>


<s:url id="home_url" action="homeMobile" namespace="/mobile"></s:url>
<s:url id="attraction_list" action="listMobileAttraction" namespace="/mobile"></s:url>
<s:url id="hike_list" action="listMobileHike" namespace="/mobile"></s:url>
<s:url id="arounde_me" action="getMapMobile" namespace="/mobile"></s:url>
<s:url id="restaurant_list" action="listMobileRestaurant" namespace="/mobile"></s:url>
<s:url id="accomodation_list" action="listMobileAccomodation" namespace="/mobile"></s:url>
<s:url id="event_list" action="listMobileEvent" namespace="/mobile"></s:url>
<%-- <s:url var="urlen" includeParams="all" action="/" value=""> --%>
<%--   	<s:param name="request_locale">en</s:param> --%>
<%-- </s:url> --%>




<!-- <div data-role="list-divider">Menu</div> -->

<ul data-role="listview">
	<li data-icon="home"><s:a cssClass="menu-item" href="%{home_url}">Home</s:a></li>
	<li><s:a cssClass="menu-item" href="%{attraction_list}"><s:text name="menu.item.attractions"></s:text></s:a></li>
</ul>
	<div class="collapsible-menu-item" data-role="collapsible"
	data-collapsed-icon="carat-r" data-expanded-icon="carat-d"
	data-inset="false" data-mini="true" data-iconpos="right">
	<h3>Gastronomia e prodotti tipici</h3>
	<ul data-mini="true" data-icon="false" data-role="listview">
		<li><s:a href="%{restaurant_list}?type=ris" cssClass="menu-item inner-item">Ristorazione</s:a></li>
		<li><s:a href="%{restaurant_list}?type=bott" cssClass="menu-item inner-item">Botteghe</s:a></li>
<%-- 		<li><s:a href="%{restaurant_list}?type=pizz" cssClass="menu-item inner-item">Pizzeria</s:a></li> --%>
	</ul>
	</div>
<ul data-role="listview">
	<li><s:a cssClass="menu-item" href="%{event_list}">Eventi</s:a></li>
	<li><s:a cssClass="menu-item" href="%{hike_list}">Escursioni</s:a></li>
	<li><s:a cssClass="menu-item" href="%{accomodation_list}">Mare</s:a></li>
		
	<li><s:a data-ajax="false" cssClass="menu-item" href="%{arounde_me}">Intorno a me</s:a></li>
<!-- 	<li data-icon="gear" data-role="list-divider">Settings</li> -->
	
</ul>
	<div class="collapsible-menu-item" data-role="collapsible"
	data-collapsed-icon="carat-r" data-expanded-icon="carat-d"
	data-inset="false" data-mini="true" data-iconpos="right">
	<h3>Language</h3>
	 <s:if test='locale.toString() == "en"'> </s:if>
	 <fieldset data-role="controlgroup" data-mini="true">
        <input type="radio" name="radio-choice-v-7" id="radio-choice-v-7a" value="it"  <s:if test='locale.toString() == "it"'>checked="checked" </s:if>>
        <label for="radio-choice-v-7a">Italiano</label>
        <input type="radio" name="radio-choice-v-7" id="radio-choice-v-7b" value="en" <s:if test='locale.toString() == "en"'>checked="checked" </s:if>>
        <label for="radio-choice-v-7b">Inglese</label>
    </fieldset>
 
	</div>
<script type="text/javascript">
var addUrlParam = function(search, key, value){
	 var re = new RegExp("([?&])" + key + "=.*?(&|$)", "i");
	  var separator = search.indexOf('?') !== -1 ? "&" : "?";
	  if (search.match(re)) {
	    return search.replace(re, '$1' + key + "=" + value + '$2');
	  }
	  else {
	    return search + separator + key + "=" + value;
	  }
};
$("input[name='radio-choice-v-7']").bind( "change", function(event, ui) {
	document.location.href = addUrlParam(document.location.href,"request_locale",$(this).val());
});
</script>